package sch.frog.behavioral.chain;

public class HandlerC implements IHandler {

    private IHandler nextHandler;

    @Override
    public void doIt(int value) {
        if(value >= 80 && value <= 100){
            System.out.println("handler c : i can do it.");
            // do something
        }else{
            if(nextHandler == null) throw new IllegalArgumentException("none can deal it.");
            else nextHandler.doIt(value);
        }
    }

    @Override
    public void setNext(IHandler handler) {
        this.nextHandler = handler;
    }
}
